FROM adoptopenjdk/openjdk11:x86_64-alpine-jdk-11.0.11_9 as build

WORKDIR /opt

ENV GRADLE_USER_HOME=/opt

# copy 当前目录的上层目录到工作目录
COPY . .

RUN sh gradlew build

FROM tomcat:9.0.55-jre11-openjdk-slim

LABEL MAINTAINER="niuyuxian <ncc0706@gmail.com>"

ENV LANG=en_US.UTF-8 \
    TZ=Asia/Shanghai

## gradle war name
COPY --from=build /opt/build/libs/build-by-docker-0.0.1.war /usr/local/tomcat/webapps/bca-admin.war